//
//  MCPath.m
//  MCPlayer
//
//  Created by M_Code on 2017/3/30.
//  Copyright © 2017年 MC. All rights reserved.
//

#import "MCPath.h"

@implementation MCPath
+ (NSString *)documentPath{
    NSString *path =  [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    return [path stringByAppendingPathComponent:kUserId];
}

+ (NSString *)documentPath:(NSString *)fileName{
    return [[self documentPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@",fileName]];
}
//临时路径
+ (NSString *)getMediaTempPathWithUrl:(NSString *)url mediaName:(NSString *)name{
    NSString * fileName =  [NSString stringWithFormat:@"%@.%@",name,[url pathExtension]];//[url pathExtension] 后缀
    NSString * path = [self documentPath:@"tmpFile"];
    NSFileManager * fileManager = [NSFileManager defaultManager];
    if (![fileManager fileExistsAtPath:path]){
        [fileManager createDirectoryAtPath:path withIntermediateDirectories:TRUE attributes:nil error:nil];
    }
    return [path stringByAppendingPathComponent:fileName];
}
//存储路径
+ (NSString *)getMediaStorePathWithUrl:(NSString *)url mediaName:(NSString *)name{
    NSString * fileName =  [NSString stringWithFormat:@"%@.%@",name,[url pathExtension]];//[url pathExtension]] 后缀
    NSString * path =[self documentPath:@"MediaFile"];
    NSFileManager * fileManager = [NSFileManager defaultManager];
    if (![fileManager fileExistsAtPath:path]){
        [fileManager createDirectoryAtPath:path withIntermediateDirectories:TRUE attributes:nil error:nil];
    }
    return [path stringByAppendingPathComponent:fileName];
}




@end
